import { NgModule } from '@angular/core';
import {APP_BASE_HREF, CommonModule} from '@angular/common';
import { CompanyComponent } from './company.component';
import { RouterModule, Routes } from '@angular/router';
import { Ng2SmartTableModule } from 'ng2-smart-table';
import { NbDialogModule} from '@nebular/theme';
import { NgxQRCodeModule } from 'ngx-qrcode2';
import { NgxEchartsModule } from 'ngx-echarts';

import { ThemeModule } from '../@theme/theme.module';
import { FoodComponent } from './food/food.component';
import { SharedModule } from '../shared/shared.module';
import {PeerSearchComponent} from '../shared/peer-search/peer-search.component';
import {PeerSetComponent} from '../shared/peer-set/peer-set.component';
import { ManufacturerComponent } from './manufacturer/manufacturer.component';
import { CompanyEditComponent } from './company-edit/company-edit.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { ProduceFindComponent } from './produce-find/produce-find.component';
import { QrcodeComponent } from './qrcode/qrcode.component';
import { ProduceAddComponent } from './produce-add/produce-add.component';
import {TokenInterceptor} from '../token.interceptor';
import {AuthGuard} from '../auth.guard';
import {HTTP_INTERCEPTORS} from '@angular/common/http';
import {CalendarFilterPipe} from '../service/calendar-filter.pipe';
import {StatusCardComponent} from '../shared/status-card/status-card.component';


const appRoutes: Routes = [
  { path: '' ,
    component: CompanyComponent ,
    children: [
      { path: 'food' ,
        component: FoodComponent,
      },
      { path: 'produce/find' ,
        component: ProduceFindComponent,
      },
      { path: 'qrcode' ,
        component: QrcodeComponent,
      },
      { path: 'produce/add' ,
        component: ProduceAddComponent,
      },
      { path: 'manufacturer' ,
        component: ManufacturerComponent,
      },
      { path: 'dashboard' ,
        component: DashboardComponent,
      },
      { path: 'company' ,
        component: CompanyEditComponent,
      },
      { path: 'peer/search' ,
        component: PeerSearchComponent,
      },
      { path: 'peer/set' ,
        component: PeerSetComponent,
      },
    ]
  }
];

@NgModule({
  declarations: [CompanyComponent, FoodComponent, ManufacturerComponent, CompanyEditComponent, DashboardComponent, ProduceFindComponent, QrcodeComponent, ProduceAddComponent, CalendarFilterPipe],
  imports: [
    CommonModule,
    RouterModule.forChild(
      appRoutes,
    ),
    ThemeModule,
    Ng2SmartTableModule,
    SharedModule,
    NbDialogModule.forChild(),
    NgxQRCodeModule,
    NgxEchartsModule,
  ],
  providers: [
    {provide: HTTP_INTERCEPTORS, useClass: TokenInterceptor, multi: true},
    AuthGuard,
  ],
})
export class CompanyModule { }
